<%--
&lt;%&ndash;
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/3/7
  Time: 9:24
  To change this template use File | Settings | File Templates.
&ndash;%&gt;
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
</head>
<body>
<div id="http"></div>
<form action="${pageContext.request.contextPath}/rest" method="post">
    <select name="_method"
            onchange="if(this.value=='GET'){this.parentNode.method='get';}else{this.parentNode.method='post';} ">
        <option value="GET">get</option>
        <option value="POST" selected="selected">post</option>
        <option value="PUT">put</option>
        <option value="DELETE">delete</option>
    </select><input type="hidden" name="msg" value="msg"><input type="submit" value="rest">
</form>
</body>
<script type="text/javascript">


  $.get({
    url:"${pageContext.request.contextPath}/rest",
    data:{
      msg:"msg"
    },
    success:function (res) {
      $("#http").append(res+"&nbsp; using $.get<br>")

    }
  });
  $.post({
    url:"${pageContext.request.contextPath}/rest",
    data:{
      msg:"msg"
    },
    success:function (res) {
      $("#http").append(res+"&nbsp; using $.post<br>")

    }
  });
  $.post({
    url:"${pageContext.request.contextPath}/rest",
    data:{
      _method:"PUT",
      msg:"msg"
    },
    success:function (res) {
      $("#http").append(res+"&nbsp; using $.post<br>")

    }
  });
  $.ajax({
    type:"POST",
    url:"${pageContext.request.contextPath}/rest/110",
    data:{
      _method:"DELETE",
      msg:"msg"
    },
    success:function (res) {
      $("#http").append(res+"&nbsp; using $.ajax<br>")

    }
  });
</script>
</html>
--%>
